package com.rich4st.wiki.controller;

import com.rich4st.wiki.domain.Test;
import com.rich4st.wiki.mapper.TestMapper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class TestController {

    @Value("${test.hello}")
    private String testHello;

    @Resource
    private TestMapper testMapper;

    /**@PostMapping
     * @RequestMapping(value = "/user/1", method = RequestMethod.GET)
     *
     * @return
     */
    @GetMapping("/hello")
    public String hello(){
        return "hello,world!" + testHello;
    }

    @GetMapping("/test/list")
    public List<Test> list(){
        return testMapper.list();
    }

    @PostMapping("/hello/post")
    public String helloPost(String name){
        return "hello," + name;
    }
}
